<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<c:import url="/view/admin/include/header/adminHeader.jsp"></c:import>
    <!-- 컨텐츠 부분 -->
	<div id="container">
    	<!-- 왼쪽 메뉴 부분 -->
    	<c:import url="/view/admin/include/left/adminLeft.jsp"></c:import>
        <!-- 왼쪽 메뉴 부분 -->
        <!-- 오른쪽 내용 부분 -->
        <dl>
        	<dd class="path">
        	홈 > 게시판 관리 > 
        		<span class="path_b">
        			<s:if test="%{boardBean.board_code.equals('BD100')}" >공지사항</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD201')}" >윤리경영 Q&A</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD202')}" >준법지원 Q&A</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD203')}" >공정거래 Q&A</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD204')}" >업무지원 Q&A</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD205')}" >법률자문 Q&A</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD206')}" >소송개시 Q&A</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD301')}" >윤리경영 자료실</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD302')}" >준법지원 자료실</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD303')}" >공정거래 자료실</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD304')}" >업무지원 자료실</s:if>
        			<s:if test="%{boardBean.board_code.equals('BD400')}" >사이버제보 </s:if>
        		</span>
        	</dd>
        </dl>
        <dl class="content">
            <dd class="">
            	<form id="boardFrm" name="boardFrm" action="/admin/boardReg.hcom" method="post" enctype="multipart/form-data">
            	<input type="hidden" id="board_code" name="board_code" value="${boardBean.board_code}" />
            	<input type="hidden" name="mem_no"	value="<s:property value="#session.id" />"> 
            	<input type="hidden" name="mem_name" value="<s:property value="#session.name" />"> 
            	<input type="hidden" id="save_type" name="save_type" value="board" />
            	<table cellspacing="0" cellpadding="0" summary="" >
                	<caption></caption>
                    	 <colgroup>
                          <col width="13%;"/>
                          <col width="87%;"/>
                         </colgroup>
                    <tbody>
                    	<tr>
                        	<th scope="row">작성자</th>
                            <td class="table_txt_left"><s:property value="#session.name" />
                            </td>
                        </tr>
                    	<tr>
                        	<th scope="row">제목</th>
                            <td class="table_txt_left"><input id="title" name="title" type="text" style="width:500px;"/></td>
                        </tr>                    
                        <tr>
                        	<th scope="row" class="table_td_bottom table_td_bottom_x">내용</th>
                            <td class="table_txt_left table_td_bottom_x"><textarea id="content" name="content" style="width:100%; height:300px;"></textarea></td>
                        </tr>
                        <tr>
							<th scope="row">첨부파일</th>
							<td class="table_txt_left" style="font-size:11px;">
							<p>
								<input type="text" id="file_name1" class="input" style="width:200px; height:14px;"  title="첨부파일" readonly="readonly"/>
                  					<span class="file_input">
                  				<input type="file" name="uploads" class="file_input_hidden" title="첨부파일" onchange="javascript: document.getElementById('file_name1').value = this.value" style="cursor: pointer;"/>
                  					<img src="/images/common/btn_file.gif" alt="첨부파일" name="find" id="find" border="0" style="cursor: pointer;"/>10MB이내 첨부
                  					</span>
           					</p>
           					<p>
                  				<input type="text" id="file_name2" class="input" style="width:200px; height:14px;"  title="첨부파일" readonly="readonly"/>
                  					<span class="file_input">
                  				<input type="file" name="uploads" class="file_input_hidden" title="첨부파일" onchange="javascript: document.getElementById('file_name2').value = this.value" style="cursor: pointer;"/>
                  					<img src="/images/common/btn_file.gif" alt="첨부파일" name="find" id="find" border="0" style="cursor: pointer;"/>10MB이내 첨부
                 				 	</span>
                 			</p>
                 			<p>
			                  	<input type="text" id="file_name3" class="input" style="width:200px; height:14px;"  title="첨부파일" readonly="readonly"/>
			                  		<span class="file_input">
			                  	<input type="file" name="uploads" class="file_input_hidden" title="첨부파일" onchange="javascript: document.getElementById('file_name3').value = this.value" style="cursor: pointer;"/>
			                  		<img src="/images/common/btn_file.gif" alt="첨부파일" name="find" id="find" border="0" style="cursor: pointer;"/>10MB이내 첨부
			                  	</span>
			                </p>
                  			</td>
						</tr>
						 <tr>
							<th scope="row" class="table_td_bottom">고정기능</th>
								<td colspan="2" class="table_txt_left table_td_bottom_comment" >
								<input type="checkbox" name="open_flag" value="Y">활성
								<input type="checkbox" name="open_flag" value="N">비활성
								<br/>
								※버튼을 체크하시면 목록 상단으로 노출됩니다
								</td>
						</tr>
                    </tbody>
                 </table>
                 </div>
                 </form>
            </dd>
        </dl>
        <dl class="paginate">  	
            <dd class="btn_right">
            	<input type="button" id="btnWrite" value="확인" class="input_btn_s b" />
            	<input type="button" id="btnList" value="목록" class="input_btn_s b" />
            </dd>
        </dl>
        <!-- 오른쪽 내용 부분 -->
    <!-- 컨텐츠 부분 -->
<c:import url="/view/admin/include/footer/adminFooter.jsp"></c:import>
<script type="text/javascript" src="/jquery/datepicker.js"></script>
<script type="text/javascript" src="/jquery/jquery.watermarkinput.js" ></script>
<script type="text/javascript">
	$().ready(function(){		
		$("#btnWrite").click(function(){
			oEditors[0].exec("UPDATE_CONTENTS_FIELD", []);
			if(validateCheck()){
				if(confirm("등록하시겠습니까?")){
					$("#boardFrm").submit();
				}		
			}
		});
		
		$("#btnList").click(function(){
			location.href="/admin/boardList.hcom?board_code="+$("#board_code").val();
		});
	});

	var oEditors = [];
	// 에디터 생성
	nhn.husky.EZCreator.createInIFrame({
		oAppRef: oEditors,
		elPlaceHolder: "content",
		sSkinURI: "/sEditor/SmartEditor2Skin.html",
		fCreator: "createSEditor2",		
	});	
	
	function pasteHTMLDemo(){
		sHTML = "<span style='color:#FF0000'>이미지 등도 이렇게 삽입하면 됩니다.</span>";
		oEditors.getById["content"].exec("PASTE_HTML", [sHTML]);
	}

	function showHTML(){
		alert(oEditors.getById["content"].getIR());
	}
	
	function validateCheck(){	
		
		if($("#title").val() == ''){
			alert('제목을 입력해주십시요');
			$("#title").focus();
			return false;
		}
		if($("#content").val() == ''){
			alert('내용을입력해주십시요');
			return false;
		}	
		return true;
	}
</script>
